#include <iostream>
#include <stdlib.h>
#include <list>
#include <map>
#include <stack>
#include <cstring>
#include <vector>
#include <exception>

#include "DataStruct\list.h"
#include "DataStruct\CSingleLinkedList.h"
#include "DataStruct\CStack.h"

using namespace std;

typedef struct Student
{
	std::string itsName;
	int itsAge;
	struct list_head itsList;
}Student;

/**
 * verifyCList - verify list operation of "DataStruct\list.h"
 */
void verifyCList()
{
	Student stu1 = {"zhang", 25};
	Student stu2 = {"wang", 25};
	Student stu3 = {"li", 25};
	list_head head; 
	INIT_LIST_HEAD(&head);
	list_add_tail(&stu1.itsList, &head);
	list_add_tail(&stu2.itsList, &head);
	list_add_tail(&stu3.itsList, &head);

	struct list_head* element = NULL;
	Student* tempStu = NULL;
	list_for_each(element, &head)
	{
		tempStu = list_entry(element, Student, itsList);
	}
	list_del(&head);
}

/**
 * verifySingleList - verify list operation of "DataStruct\CSingleLinkedList.h"
 */
void verifySingleList()
{
	CList<int> myList;
	myList.push_back(1);
	myList.push_back(2);
	myList.push_back(3);
	myList.push_back(4);
	myList.push_back(5);
	myList.insert(0, 0);
	myList.insert(6, 6);

	myList.remove(4);
	myList.remove(5);
}

/**
 * verifySingleList - verify list operation of "DataStruct\CStack.h"
 */
void verifyStackOperation()
{
	CStack<int> myStack;
	myStack.push(0);
	myStack.push(1);
	myStack.push(2);
	myStack.push(3);
	myStack.push(4);
	myStack.push(5);
	myStack.top();

	// for pop() operation, user should judge empty stack by self
	if(!myStack.empty())
	{
		myStack.pop();
	}
}

int main()
{
	int arr[] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};

	// verifyCList();
	verifyStackOperation();
	
    return EXIT_SUCCESS;
}